package com.twu.biblioteca;

/**
 * Created by aswathik on 6/19/14.
 */
public class Movie implements LibraryItem{
    private String title;
    private String director;
    private int yearOfRelease;
    private int rating;

    Movie(String title, String director, int yearOfRelease, int rating) {
        this.title = title;
        this.director = director;
        this.yearOfRelease = yearOfRelease;
        this.rating = rating;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Movie movie = (Movie) o;

        if (rating != movie.rating) return false;
        if (yearOfRelease != movie.yearOfRelease) return false;
        if (!director.equals(movie.director)) return false;
        if (!title.equals(movie.title)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = title.hashCode();
        result = 31 * result + director.hashCode();
        result = 31 * result + yearOfRelease;
        result = 31 * result + rating;
        return result;
    }

    public String getTitle() {
        return title;
    }

    public String getDirector() {
        return director;
    }

    public int getYearOfPublication() {
        return yearOfRelease;
    }

    public int getRating() {
        return rating;
    }
}
